﻿using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace Himp.TaskScheduling.V1
{
    [Area(TaskSchedulingRemoteServiceConsts.ModuleName)]
    [RemoteService(Name = TaskSchedulingRemoteServiceConsts.RemoteServiceName)]
    [Route("api/taskScheduling/standardTestTask")]
    [ApiVersion("1.0")]
    [ApiController]
    [ControllerName("standardTestTask")]
    public class StandardTestTaskController : TaskSchedulingController, IStandardTestTaskService
    {
        private IStandardTestTaskService _standardTestTaskService;

        public StandardTestTaskController(IStandardTestTaskService standardTestTaskService)
        {
            _standardTestTaskService = standardTestTaskService;
        }

        [HttpGet]
        public Task<PagedResultDto<StandardTestTaskDto>> GetListAsync([FromQuery] StandardTestTaskInput input)
        {
            return _standardTestTaskService.GetListAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("item")]
        public Task<List<StandardTestItemDto>> GetItemListAsync()
        {
            return _standardTestTaskService.GetItemListAsync();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPut]
        [Route("item/{id}")]
        public async Task PutItemValiAsync(long id, [FromQuery] bool valiFlag = false)
        {
            await _standardTestTaskService.PutItemValiAsync(id, valiFlag);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("audit")]
        public async Task PostAuditAsync([FromBody] StandardTestTaskAuditDto input)
        {
            await _standardTestTaskService.PostAuditAsync(input);
        }
    }
}
